﻿using System;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;
using Jayden.Dll.Web.HtmlControls.Interfaces;

namespace Jayden.Dll.Web.HtmlControls
{
	public class IFrame: HtmlElement, WithSrc, WithName, WithWidth, WithHeight, WithSeamless
	{
		public IFrame()
			: base(IFrameDescription.Instance) { }

		public string Src { get { return this["src"]; } set { this["src"] = value; } }
		public string SrcDoc { get { return this["srcdoc"]; } set { this["srcdoc"] = value; } }
		public string Name { get { return this["name"]; } set { this["name"] = value; } }
		public uint? Width { get { return GetAttributeUint("width"); } set { SetAttribute("width", value); } }
		public uint? Height { get { return GetAttributeUint("height"); } set { SetAttribute("height", value); } }
		public string SandBox { get { return this["sandbox"]; } set { this["sandbox"] = value; } }
		public bool Seamless { get { return GetAttributeBool("seamless"); } set { SetAttribute("seamless", value); } }
	}
	public class IFrameDescription : HtmlElementDescription
	{
		public static readonly IFrameDescription Instance = new IFrameDescription();
		private IFrameDescription() : base("iframe", HtmlVersion.Html4, true, true) { }
		public override Type ControlType { get { return typeof(IFrame); } }
		public override bool IsPhrasingElement { get { return true; } }
		public override string Description { get { return "introduces a new nested browsing context."; } }
	}
}
